﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GC2.Entities.Admin;
using GC2.Funciones.General;
using GC2.Bussines.BMAdmin;
using GC2.ExceptionHandler;

public partial class Admin_VerSolicitudes : GenericPage
{
    FunctionsSite fs = new FunctionsSite();

    private List<Solicitudes> listaSolicitudes
    {
        get
        {
            return (List<Solicitudes>)Session["listaSolicitudes"];
        }
        set
        {
            Session["listaSolicitudes"] = value;
        }
    }


    #region Controles

    #region Page_Load
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            Usuarios usuario = new Usuarios();
            usuario.Cliente = "comercial";
            Session["UsuarioActual"] = usuario;
        }

    }
    #endregion

    #region btnVer_Click
    protected void btnVer_Click(object sender, EventArgs e)
    {
        gridDataBaund();
    }
    #endregion

   
    #region gvSolicitudes_PageIndexChanging
    protected void gvSolicitudes_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        try
        {
            gvSolicitudes.PageIndex = e.NewPageIndex;
            gridDataBaund();
        }
        catch (Exception ex) { ErrorUI(ex); }
    }
    #endregion

    #region gvSolicitudes_SelectedIndexChanged
    protected void gvSolicitudes_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            // Evento manejado por Java.
        }
        catch (Exception ex) { ErrorUI(ex); }
    }
    #endregion

    #region gvSolicitudes_RowDataBound
    protected void gvSolicitudes_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
           
        }
        catch (Exception ex) { ErrorUI(ex); }
    }
    #endregion  

    #endregion


    #region Metodos

     
    #region gridDataBaund
    private void gridDataBaund()
    {
        try
        {
            listaSolicitudes = (List<Solicitudes>)Session["listaSolicitudes"];
            Solicitudes solicitudD = new Solicitudes();
            Solicitudes solicitudH = new Solicitudes();

            {
                solicitudD.FechaEstado = Convert.ToInt64(txtFechaD.Text);
                solicitudH.FechaEstado = Convert.ToInt64(txtFechaH.Text);
                BMSolicitudes bmSolicitudes = new BMSolicitudes(Connection);
                listaSolicitudes = bmSolicitudes.BMSolicitudesSearch(solicitudD,solicitudH);
                gvSolicitudes.DataSource = listaSolicitudes;
            }
            gvSolicitudes.DataBind();
        }
        catch (Exception ex) { ErrorUI(ex); }
    }
    #endregion  


    #endregion
   
}
